package my.jwds.p100;

import my.jwds.p94.TreeNode;

public class IsSameTree {

    public static void main(String[] args) {
        IsSameTree o = new IsSameTree();
        TreeNode node = TreeNode.to_binary(new int[]{1,2,3});
        TreeNode node1 = TreeNode.to_binary(new int[]{2,2,3});
        System.out.println(o.isSameTree(node,node1));
    }

    public boolean isSameTree(TreeNode p, TreeNode q) {
        return p==null&&q==null || p!=null&&q!=null && p.val==q.val && isSameTree(p.left,q.left) && isSameTree(p.right,q.right);
    }
}
